/*! \file scrollpanel.h	
	This is the header file for scrollpanel.cpp
	
	This contains the ScrollPanel class
*/


#ifndef SCROLL_PANEL_H
#define SCROLL_PANEL_H

#include "scrollbar.h"

/**
	\class ScrollPanel

	This is a container that allows scrolling. It has a scroll bar at the right side.
*/
class ScrollPanel : public Container {
private:
	/**
	* Only one scrollbar for now, and it's vertical
	*/
	Scrollbar vScrollBar;

public:
	/**
	* Constructor
	*/
	ScrollPanel( Component* parent );

	/**
	* This returns the sliderPosition of the vScrollBar.
	* sliderPosition is how many pixels you have scrolled down (so it could be something like 5000), not how many
	* pixels down the slider is.
	*/
	int getScrollPosition();

	/**
	* This just calls setSize anyway
	*/
	void setWidth( int newW );

	/**
	* This just calls setSize anyway
	*/
	void setHeight( int newH );
	
	/**
	* This returns vScrollBar's width
	*/
	int getScrollbarWidth();
	
	/**
	* This forces the slider down to its maxPosition, which is the bottom
	*/
	void scrollToBottom();
	
	/**
	* This changes the size of the vScrollBar, moves it to the right side of this ScrollPanel,
	* tells all children that this changed size, and then updates the scroll position since
	* it might be out of bounds now that it was resized.
	*/
	void setSize( int newW, int newH );
	
	/**
	* Draws this and its children
	*/
	void draw();
	
	/**
	* This just passes an update() to its children
	*/
	void update();
	
	/**
	* This is called from a child. It tells this that the child changed size.
	* \param which the child that just changed size
	*/
	void childChangedSize( Component* which );
	
	/**
	* If any part of the scrollpanel has the focus, then it will automatically
	* adjust the scroll bar
	*/
	bool handleMouseWheel( int pos );
	
};


#endif
